#include <Arduino.h>
#include "mywifi.h"
#include "mydht.h"
#include "mqtt.h"
#include "gy30.h"
#include "mq135.h"

const char * ssid = "esp32";
const char * password = "1234567890";

const char *device_id = "179155376103624704";
// MQTT Broker
const char *mqtt_broker = "web.yunnet.top";
// 服务端的topic
const char *topic = "/envper/server";
const char *mqtt_username = "esp32";
const char *mqtt_password = "esp32";
const int mqtt_port = 12883;

void setup() {
    Serial.begin(115200);
    connect_wifi(ssid, password);
    connect_mqtt(device_id, mqtt_broker, topic, mqtt_username, mqtt_password, mqtt_port);
    initBH1750();
    init_mq135();
}

void loop() {
    delay(5000);
    readDHTData();
    readBH1750Data();
    read_mq135();
    publish();
}